package com.example.demo.utils;

import lombok.Data;

import org.springframework.http.HttpStatus;

import com.alibaba.fastjson.JSONObject;

@Data
public class ApiResult {

	private Integer code;

	private String message;

	private Object data;

	public ApiResult(Integer code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public static Object  ok(final Object data) {
		ApiResult response = new ApiResult(HttpStatus.OK.value(), HttpStatus.OK.name(), data);
		return response;
	}
	
	public static Object  fail(final String message) {
		ApiResult response = new ApiResult(HttpStatus.FAILED_DEPENDENCY.value(), message, null);
		return response;
	}
}
